
package andre.grids.network.threads;

import andre.grids.filesystem.common.DirectoryOperations;

/**
 *
 * @author andre
 */
public class MasterDirectoryNotifyThread implements Runnable {
    
    private DirectoryOperations operations;
    private String path;
    private String master;

    public String getMaster() {
        return master;
    }

    public void setMaster(String master) {
        this.master = master;
    }

    public DirectoryOperations getOperations() {
        return operations;
    }

    public void setOperations(DirectoryOperations operations) {
        this.operations = operations;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }     

    public void run() {
        int i = 0;
        while(i < 3) // máximo de três tentativas para executar
        try
        {
            i++;
            operations.setDirectoryMaster(path, master);
            break; // se retornou sem erro então pode parar
        }
        catch(Exception e)
        {
            andre.grids.util.log.Log.logException(e, this);
        }
    }

}
